# This file is part of BlackArch Linux ( http://blackarch.org ).
# See COPYING for license details.

pkgname=slackpirate
pkgver=148.99e470f
pkgrel=1
pkgdesc='Slack Enumeration and Extraction Tool - extract sensitive information from a Slack Workspace.'
arch=('any')
groups=('blackarch' 'blackarch-social' 'blackarch-recon')
url='https://github.com/emtunc/SlackPirate'
license=('GPL3')
depends=('python-requests' 'python-colorama' 'python-termcolor'
         'python-argparse')
makedepends=('git')
source=("$pkgname::git+https://github.com/emtunc/SlackPirate.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python SlackPirate.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

